import React, { Component } from "react";
import PropTypes from "prop-types";
import list from "./index.module.css";
import Item from "../Item";
export default class List extends Component {
  static propTypes = {
    data: PropTypes.array.isRequired,
    handleCheck: PropTypes.func.isRequired,
    deleteTodo:PropTypes.func.isRequired,
  };
  render() {
    const { data, handleCheck, deleteTodo } = this.props;
    return (
      <div className={list.list}>
        {data.map((item) => {
          return (
            <Item
              key={item.id}
              {...item}
              handleCheck={handleCheck}
              deleteTodo={deleteTodo}
            ></Item>
          );
        })}
      </div>
    );
  }
}
